<template>
  <div class="item pointer" @click="toDetail">
    <div class="item-info flex">
      <div class="item-logo flex">
        <img :src="item.img">
        <p v-if="item.Unlock" class="flex-center flex-align-items-center">
          <i class="iconfont icon-jiesuo"></i>
        </p>
      </div>
      <div>
        <p class="item-name font-18-B ellipsis-1">{{ item.name }}</p>
        <p class="item-cate font-12">{{ item.cate }}</p>
      </div>
      <i class="item-follow iconfont" :class="item.follow ? 'icon-31guanzhu1xuanzhong' : 'icon-guanzhu'"></i>
    </div>
    <div class="item-data flex flex-wrap">
      <div class="flex flex-align-items-center font-14">
        推广红人：<span class="font-14-B">{{ numConvert(item.count, 2) }}</span>
      </div>
      <div class="flex flex-align-items-center font-14">
        互动率：<span class="font-14-B">{{ item.count }}</span>
      </div>
      <div class="flex flex-align-items-center font-14">
        推广视频：<span class="font-14-B">{{ numConvert(item.count, 2) }}</span>
      </div>
      <div class="flex flex-align-items-center font-14">
        曝光量：<span class="font-14-B">{{ numConvert(item.count, 2) }}</span>
      </div>
    </div>
  </div>
</template>

<script setup>
import { defineProps } from 'vue';
import numConvert from '@/js/numConvert.js';
import { useRouter } from 'vue-router';

const router = useRouter();

const props = defineProps(['item']);

const toDetail = () => {
  router.push(`/brandDetail?id=${props.item.id}`);
}
</script>

<style lang="less" scoped>
.item {
  padding: 16px;
  border-radius: 10px;
  border: 1px solid #ededed;

  &:hover {
    transition: all .5s;
    transform: translateY(-4px);
    box-shadow: 0 4px 10px 0 rgba(0, 0, 0, .1);

    .icon-guanzhu {
      display: block !important;
    }
  }

  .item-info {
    padding-bottom: 16px;
    border-bottom: 1px solid #f4f4f4;
    position: relative;

    .item-logo {
      position: relative;
      border-radius: 4px;
      overflow: hidden;
      margin-right: 12px;

      img {
        width: 60px;
        height: 60px;
      }

      p {
        position: absolute;
        right: 0;
        bottom: 0;
        width: 25px;
        height: 25px;
        background: rgba(248, 82, 119, .1);

        i {
          color: @main-color;
        }
      }
    }

    .item-name {
      color: #333;
      line-height: 28px;
      max-width: 150px;
      margin-bottom: 1px;
    }

    .item-cate {
      height: 24px;
      padding: 0 8px;
      background: hsla(0, 0%, 93%, .4);
      border-radius: 4px;
      border: 1px solid #dcdee0;
      line-height: 22px;
      color: #666;
    }

    .item-follow {
      position: absolute;
      right: 6px;
      top: 6px;
      z-index: 10;
      color: @main-color;

      &.icon-guanzhu {
        display: none;
      }
    }
  }

  .item-data {
    padding-top: 16px;

    div {
      width: 50%;
      color: #666;
      line-height: 20px;

      span {
        color: #333;
      }
    }
  }
}
</style>